template "Boot sector FAT32"

// Sample template by Stefan Fleischmann

// To be applied to the very first sector of a logical FAT32-formatted hard drive.

description "BIOS Parameter Block (BPB) for a FAT32 partition"
appliesto disk
requires 2 "90"
requires 0x52 "46 41 54 33 32" // ="FAT32" at offset 52

begin
	goto 3
	char[8]	"OEM"
	uint16	"Bytes per sector"
	uint8		"Sectors per cluster"
	uint16	"Reserved sectors"
	uint8		"FATs"
	uint16	"Root entries"
	uint16	"Sectors (on small volumes)"
	uint8		"Media descriptor"
	uint16	"Sectors per FAT"
	uint16	"Sectors per track"
	uint16	"Heads"
	uint32	"Hidden sectors"
	uint32	"Sectors (on large volumes)"
	
	section	"FAT32 Section"
	uint32	"Sectors per FAT"
	uint16	"Flags"
	uint16	"Version"
	uint32	"Root cluster"
	uint16	"File system info sector"
	uint16	"Backup boot sector"
	read-only hex 12 "(reserved)"
	endsection
	
	hex 1		"BIOS drive number (hex)"
	read-only uint8 (unused)
	hex 1		"XBS"
	uint32	"Serial number as integer"
	move -4
	hex 4		"Serial number as hex"
	char[11] "Volume label"
	char[8]	"File system"
end